package main.java.com.example.demo.service;

import com.example.demo.mapper.CartMapper;
import com.example.demo.pojo.Cart;
import com.example.demo.util.DateUtil;
import com.example.demo.vo.CartVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @Description:
 * @Param:
 * @Author:
 * @Date:
 */
@Service
public class CartService {

    @Autowired
    private CartMapper cartMapper;

    public void insertGoodIntoCart(Cart cart){
        cart.setCreateTime(DateUtil.getDateTimeStringYYYY(new Date()));
        cartMapper.insertGoodIntoCart(cart);
    }

    public void delCart(Cart cart){
        cartMapper.delCart(cart);
    }

    public List<CartVo> findCart(Cart cart) {
        return cartMapper.findCart(cart);
    }
}
